import 'dart:convert';

// To parse this JSON data, do
//
//     final user = userFromJson(jsonString);

import 'dart:convert';

class User {
  int? empId; //  员工Id
  String? employeeName; //  员工姓名
  String? orgName; //经销商名称
  int? gender; //    性别
  String? shopName; //  门店名称
  String? employeeNo; //员工编号
  int? userId; //用户id
  String? userCode; //登录账号
  int? orgId; //  经销商Id
  String? mobilePhone; //  手机号码
  String? roleCode; //  角色代码
  String? roleName; // 角色名称
  int? shopId; // 门店名称  门店ID
  String? headPortrait;
  int? companyId; //区分厂端-店端

  User(
      {required this.empId,
      required this.employeeName,
      required this.orgName,
      required this.gender,
      required this.shopName,
      required this.employeeNo,
      required this.userId,
      required this.userCode,
      required this.orgId,
      required this.mobilePhone,
      required this.roleCode,
      required this.roleName,
      required this.shopId,
      required this.headPortrait,
      required this.companyId});

  factory User.fromJson(Map<String, dynamic> json) => User(
      empId: json["empId"],
      employeeName: json["employeeName"],
      orgName: json["orgName"],
      gender: json["gender"],
      shopName: json["shopName"],
      employeeNo: json["employeeNo"],
      userId: json["userId"],
      userCode: json["userCode"],
      orgId: json["orgId"],
      mobilePhone: json["mobilePhone"],
      roleCode: json["roleCode"],
      roleName: json["roleName"],
      shopId: json["shopId"],
      headPortrait: json["headPortrait"],
      companyId: json["companyId"]);

  factory User.fromJson2() => User(
      empId: 0,
      employeeName: "",
      orgName: "",
      gender: 0,
      shopName: "",
      employeeNo: "",
      userId: 0,
      userCode: "",
      orgId: 0,
      mobilePhone: "",
      roleCode: "",
      roleName: "",
      shopId: 0,
      headPortrait: "",
      companyId: 0);

  Map<String, dynamic> toJson() => {
        "empId": empId,
        "employeeName": employeeName,
        "orgName": orgName,
        "gender": gender,
        "shopName": shopName,
        "employeeNo": employeeNo,
        "userId": userId,
        "userCode": userCode,
        "orgId": orgId,
        "mobilePhone": mobilePhone,
        "roleCode": roleCode,
        "roleName": roleName,
        "shopId": shopId,
        "headPortrait": headPortrait,
        "companyId": companyId
      };

  static User userFromJson(String str) => User.fromJson(json.decode(str));

  static String userToJson(User data) => json.encode(data.toJson());

  static User userClean() => User.fromJson2();
}
